<template>
    <view class="news-cell">
        <view class="flexCenter mar-top-s bg-fff" 
            v-for="(news,index) of newsList" :key="news.type"
            @click="toNews(index)">
            <view class="news-content-left pad-hov-mm flex1">
                <view class="title">{{ news.title }}</view>
                <view class="date font-ss pad-top-s">{{ news.date }}</view>
            </view>
            <image class="news-content-img" :src="news.imgUrl"></image>
        </view>
    </view>
</template>

<script>
    export default {
        props: {
            newsList: {
                type: Array,
                default: []
            },
            type: {
                type: [String, Number],
                default: 1
            }
        },
        methods: {
            toNews(index) {
                uni.navigateTo({
                	url: "../../pages/newsRich/newsRich?id=" + this.newsList[index].id + "&type=" + this.type
                })
            }
        }
    }
</script>

<style>
    .news-cell {
        font-size: 15px;
    }
    
    .news-content-img {
        width: 120px;
        height: 90px;
    }

    .news-content-left .title {
        display: -webkit-box;
        -webkit-box-orient: vertical;
        -webkit-line-clamp: 2;
        overflow: hidden;
        text-overflow: ellipsis;
        line-height: 1.5;
    }

    .news-content-left .date {
        color: #666;
    }
</style>
